package gui.client;

import java.awt.event.ActionListener;

import gui.MenuName;
import gui.client.listener.ClientMenuEventListener;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

public class ClientMenuBar extends JMenuBar{

	private static final long serialVersionUID = 1L;
	ActionListener menuListenr;
	JMenu account;
	JMenu prefence;
	JMenu help;

	public ClientMenuBar(){

		initMenus();
		this.add(account);
		//this.add(prefence);
		this.add(help);


	}

	private void initMenus() {
		// TODO Auto-generated method stub
		menuListenr = new ClientMenuEventListener();
		initAccountMenu();
		initPrefenceMenu();
		initHelpMenu();
	}

	private void initHelpMenu() {
		// TODO Auto-generated method stub
		help=new JMenu(MenuName.HELP);
		JMenuItem doc=new JMenuItem(MenuName.DOCUMENT);
		JMenuItem about=new JMenuItem(MenuName.ABOUT);

		doc.addActionListener(menuListenr);
		about.addActionListener(menuListenr);

		help.add(doc);
		help.add(about);
	}

	private void initPrefenceMenu() {
		// TODO Auto-generated method stub

	}

	private void initAccountMenu() {
		// TODO Auto-generated method stub
		account=new JMenu(MenuName.ACCOUTCLIENT);
		JMenuItem connect=new JMenuItem(MenuName.CONNECTTOSERVER);
		JMenuItem logout=new JMenuItem(MenuName.LOGOUT);
		JMenuItem exit = new JMenuItem(MenuName.EXIT);
		connect.addActionListener(menuListenr);
		logout.addActionListener(menuListenr);
		exit.addActionListener(menuListenr);
		account.add(connect);
		account.add(logout);
		account.add(exit);
	}


}
